Conversation
e56d463 to
201cd7b
Compare
|
todo: drop illegal enpassant squares when parsing fen |
|
works on my end too - no time losses |
|
cool very nice |
|
fastchess/app/src/variants/shogi.rs Line 933 in 891d92a is this assert really necessary? the book I use for stoat tests includes some positions where the side to move is in check, so fastchess crashes because of it |
|
hm that came straight from @87flowers https://github.com/87flowers/shogitest/blob/f620e5b69911ff4d37807f11bcf4da93820e7fd7/src/shogi.rs#L1002 maybe they can clarify the intention? I know very little about shogi |
|
I hadn't thought too hard about the I suggest the following change: diff --git a/app/src/variants/shogi.rs b/app/src/variants/shogi.rs
index cc874d8..0cd6769 100644
--- a/app/src/variants/shogi.rs
+++ b/app/src/variants/shogi.rs
@@ -930,12 +930,15 @@ pub(crate) struct Game {
impl Game {
pub fn new(startpos: Position) -> Game {
- assert!(!startpos.is_in_check());
+ let mut last_not_in_check_ply = [-1; 2];
+ if !startpos.is_in_check() {
+ last_not_in_check_ply[startpos.stm.to_index()] = 0;
+ }
Game {
current_position: startpos,
moves: vec![],
history: vec![startpos],
- last_not_in_check_ply: [-1, -1],
+ last_not_in_check_ply,
}
} |
|
here you're assigning fastchess/app/src/variants/shogi.rs Line 984 in 891d92a but here you're assigning the ply: last_not_in_check_ply[startpos.stm.to_index()] = 0;
won't that cause any issues? |
history: vec![startpos],
|
|
ohhh, you're right |
|
okay thanks you two :) pushed a patch |
|
if there are more shogi things to support you can list them, though I'll (myself) will probably only implement the sane ones and not delve into weird cutechess things.. unless someone else takes that up |
|
fastchess/app/src/variants/shogi.rs Lines 1416 to 1420 in 2de63ca could you update this? |
|
fastchess/app/src/variants/shogi.rs Lines 1353 to 1357 in 2de63ca this part as well |
|
wdym |
|
I mean I think it should be something like this: --- a/app/src/variants/shogi.rs
+++ b/app/src/variants/shogi.rs
@@ -1211,7 +1211,7 @@
// ── Game Trait Implementation ────────────────────────────────────────────────
-use crate::game::{GameStatus, Side as GameColor};
+use crate::game::{GameOverReason, GameStatus, Side as GameColor};
use crate::types::VariantType;
use crate::variants::GameMove;
@@ -1262,6 +1262,7 @@
pub struct ShogiGame {
game: Game,
ply_count: u32,
+ last_outcome: GameOutcome,
}
impl ShogiGame {
@@ -1270,6 +1271,7 @@
Self {
game: Game::new(Position::default()),
ply_count: 0,
+ last_outcome: GameOutcome::Undetermined,
}
}
@@ -1279,6 +1281,7 @@
Some(Self {
game: Game::new(position),
ply_count: 0,
+ last_outcome: GameOutcome::Undetermined,
})
}
@@ -1290,6 +1293,7 @@
/// Makes a move and returns true if successful.
fn make_shogi_move(&mut self, mv: &ShogiMove) -> bool {
let outcome = self.game.do_move(mv.inner());
+ self.last_outcome = outcome;
if outcome != GameOutcome::LossByIllegal(self.game.stm()) {
self.ply_count += 1;
true
@@ -1351,9 +1355,12 @@
}
fn status(&self) -> GameStatus {
- // Check for game over conditions
- // For now, we return ongoing - the actual outcome is tracked by do_move
- GameStatus::ONGOING
+ let reason = match self.last_outcome {
+ GameOutcome::Checkmated(_) => GameOverReason::Checkmate,
+ GameOutcome::DrawBySennichite => GameOverReason::Repetition,
+ _ => GameOverReason::None,
+ };
+ GameStatus { reason }
}
fn parse_move(&self, notation: &str) -> Option<Box<dyn GameMove>> {
@@ -1414,8 +1421,6 @@
}
fn is_threefold_repetition(&self) -> bool {
- // Shogi uses fourfold repetition (sennichite), not threefold
- // For now, return false as we don't track position history
- false
+ self.last_outcome == GameOutcome::DrawBySennichite
}
} |
How to test this branch, check it out via git and run
makethis should give you a./fastchessexecutable in the same dir.This requires cargo/rust
https://rust-lang.org/tools/install/
changes:
breaking changes:
issues (known):
fixed issues (done):
This wasn't actually an issue but rather slow termination, similar to
refactor: make termination of engines happen in parallel #984
perf:
./fastchess -engine name=sf-dev1 cmd=./stockfish \ -engine name=sf-dev2 cmd=./stockfish \ -rounds 50 -concurrency -1 -openings file=UHO_Lichess_4852_v1.epd format=epd \ -each tc=1+0.01 dir=/home/me/Github/Stockfish/src/ -check-mate-pvs;